<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/

$router->get('/', function () use ($router) {
    return 'Billing API';
});


$router->group([
    'prefix' => 'billing-api',
], function() use ($router) {
    $router->post('/payment/notify', 'PaymentController@notify');
    $router->group([
        'middleware' => ['oauth.consumer:student', 'oauth.scope:student']
    ], function () use ($router) {
        $router->get('/orders', 'OrderController@index');
        $router->post('/orders', 'OrderController@store');
        $router->get('/orders/{orderId}', 'OrderController@show');
        $router->get('/orders/{orderId}/pay', 'OrderController@pay');
        $router->post('/orders/{orderId}/cancel', 'OrderController@cancel');
        $router->post('/orders/{orderId}/unpay', 'OrderController@unPay');
    });
});
